package com.google.gwt.sample.dynatablerf.server.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;

@Entity
@NamedQuery(name = Usuario.USUARIO_PESQUISAR, query = "SELECT u FROM Usuario u WHERE "
		+ "(:id is null or u.id = :id)"
		+ "AND (:login is null or u.login LIKE :login)")
public class Usuario extends AbstractEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String USUARIO_PESQUISAR = "Usuario.pesquisar";

	private String nome;

	@Column(unique = true)
	private String login;

	private String senha;

	@Column(columnDefinition = "BIT")
	private boolean isAtivo;

	@Column(columnDefinition = "BIT")
	private boolean isAdministrador;

	public Usuario() {
		super();
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public boolean isAtivo() {
		return isAtivo;
	}

	public void setAtivo(boolean isAtivo) {
		this.isAtivo = isAtivo;
	}

	public boolean isAdministrador() {
		return isAdministrador;
	}

	public void setAdministrador(boolean isAdministrador) {
		this.isAdministrador = isAdministrador;
	}

	@Override
	public String toString() {
		return this.nome;
	}

}
